package ch07_GUI编程;

import javax.swing.*;
import java.awt.*;

public class PanelDemo {
	public static void main(String[] args) {
		BaseFrame f =new BaseFrame("JPanel 演示");
		JPanel p1 =new JPanel();
		JPanel p2 =new JPanel();

		JButton b1 =new JButton ("按钮一");
		JButton b2 =new JButton ("按钮二");
		JButton b3 =new JButton ("按钮三");

		p1.add(b1);
		p1.setSize(80,60);
		p1.setLocation(5,10);
		p1.setBackground(Color.LIGHT_GRAY);

		p2.add(b2);
		p2.add(b3);
		p2.setSize(80,70);
		p2.setLocation(40,50);
		p2.setBackground(Color.DARK_GRAY);

		f.add(p2);
		f.add(p1);
		f.showMe();
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
}
